/**
 * 
 */
package com.easidea.tim.entity.finance;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springside.core.dao.extend.Undeletable;

import com.easidea.tim.entity.BaseEntity;
import com.easidea.tim.entity.supply.Sup;


/**
 * 应付汇总
 * 
 * @author Harrison
 *
 */
@Entity(name="tim_finance_shouldpay_summary")
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Undeletable(status="deleted")
@Cache(region="tim_finance_shouldpay_summary",usage=CacheConcurrencyStrategy.READ_WRITE)
public class ShouldPaySummary extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4345540497381166712L;

	public final static Short PAY_CLEARED_NOT = 0; /* 未付清 */
    public final static Short PAY_CLEARED_YES = 1; /* 已付清 */
	
	private Double amount; // 总额
	private Double payed;  // 已支付额
	private Sup supplier; // 供应商
	private List<ShouldPay> shouldPayList; // 应付列表
	private Short cleared; /* 是否已付清 */
	

	public ShouldPaySummary(){
		
	}

	/**
	 * @return the amount
	 */
	@Column(name="amount", columnDefinition="double not null default 0")
	public Double getAmount() {
		return amount;
	}
	/**
	 * @param amount the amount to set
	 */
	public void setAmount(Double amount) {
		this.amount = amount;
	}
	/**
	 * @return the payed
	 */
	@Column(name="payed", columnDefinition="double not null default 0")
	public Double getPayed() {
		return payed;
	}
	/**
	 * @param payed the payed to set
	 */
	public void setPayed(Double payed) {
		this.payed = payed;
	}
	/**
	 * @return the supplier
	 */
	@ManyToOne( fetch=FetchType.LAZY)
	@JoinColumn(name="supplier_id", nullable = false)
	public Sup getSupplier() {
		return supplier;
	}
	/**
	 * @param supplier the supplier to set
	 */
	public void setSupplier(Sup supplier) {
		this.supplier = supplier;
	}
	/**
	 * @return the shouldPayList
	 */
	@OneToMany(fetch=FetchType.LAZY, mappedBy="shouldPaySummary")
	public List<ShouldPay> getShouldPayList() {
		return shouldPayList;
	}
	/**
	 * @param shouldPayList the shouldPayList to set
	 */
	public void setShouldPayList(List<ShouldPay> shouldPayList) {
		this.shouldPayList = shouldPayList;
	}
	/**
	 * @return the cleared
	 */
	@Column(name="cleared", columnDefinition="smallint default 0")
	public Short getCleared() {
		return cleared;
	}
	/**
	 * @param cleared the cleared to set
	 */
	public void setCleared(Short cleared) {
		this.cleared = cleared;
	}
	
	
	
}
